﻿
CREATE FUNCTION fn_MakeHeader(
	@Text nvarchar(4000)
)RETURNS nvarchar(4000) AS
BEGIN
DECLARE @Out sysname 

SET @Text = REPLACE(@Text,'_',' ')
SELECT @Out = LEFT(@Text,1),@Text = SUBSTRING(@Text,2,256)

WHILE LEN(@Text) > 0 BEGIN
	IF ASCII(@Text) & 32 = 0 SET @Out = @Out + ' '
	SELECT @Out = @Out + LEFT(@Text,1),@Text = SUBSTRING(@Text,2,256)
END

RETURN @Out
END

